import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.firefox.FirefoxDriver;

import java.util.concurrent.TimeUnit;

/**
 * @author:CoolTiger
 * @description: TODO
 * @date:2024/03/06/20:09:21
 **/
public class demo {
    public static void main(String[] args) throws InterruptedException {
        System.setProperty("webdriver.chrome.driver","G:\\Desktop\\chromedriver-win64\\chromedriver.exe");   //设置chrome驱动程序的路径

        // 1.创建webdriver驱动
        ChromeOptions options = new ChromeOptions();
        //options.setBinary("C:\\Users\\19760\\Downloads\\chrome-win64\\chrome.exe");
        WebDriver driver = new ChromeDriver(options);
        // 2.打开百度首页
        driver.get("https://www.baidu.com");
        // 3.获取输入框，输入selenium
        driver.findElement(By.id("kw")).sendKeys("selenium");
        // 4.获取“百度一下”按钮，进行搜索
        driver.findElement(By.id("su")).click();
        System.out.println( driver.getTitle());
        // 5.退出浏览器
       // driver.quit();
    }
}
